package com.jdcjk.chat;

import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.roster.Roster;
import org.jivesoftware.smack.roster.RosterEntry;
import org.jivesoftware.smack.roster.RosterLoadedListener;
import org.jxmpp.util.XmppStringUtils;

import java.util.Collection;

/**
 * Created by dong on 2016/8/5.
 * 获取好友在线状态监听器
 */
public class OpenFireRosterLoadedListener implements RosterLoadedListener {
    @Override
    public void onRosterLoaded(Roster roster) {
        Collection<RosterEntry> entries = roster.getEntries();
        for (RosterEntry entry : entries) {
            Presence presence = roster.getPresence(entry.getUser());
            String phone = XmppStringUtils.parseLocalpart(entry.getUser());
        }
    }
}
